vcVolumeDetector

vcVolumeDetector detects when components' geometries intersect with a defined box-like volume in the 3D world. The detection volume is a axis-aligned box in world coordinates, which is defined by two corner points. Simulation nodes can be included or excluded from detection using the NodeList.

See in: Overview

Module: vcCore

Parent: vcObject

Children -

Referenced by: vcWorld.createVolumeDetector()

Properties

Learn how to use properties here. The properties are also inherited from the parent class.

NameTypeAccessDescription
Corner1vcVectorRWGets or sets the lower corner of box in World coordinate system.
Corner2vcVectorRWGets or sets the upper corner of box in World coordinate system.
HitCountIntegerRGets the number of detected collisions with box.
NodeListlistRWGets or sets a list of one or more nodes that can trigger a collision with box.
TestMethodvcVolumeDetectorTestMethodRWGets or sets test method for detecting collisions.
See vcVolumeDetectorTestMethod constants for more information.
TransformationvcMatrixRWGets or sets the position matrix of box in World coordinate system.

Methods

Learn how to use methods here. The methods are also inherited from the parent class.

NameReturn TypeParametersDescription
getHitFeaturevcFeatureInteger indexReturns a vcFeature at a given index in detected collisions list.
See more
Parameters:
index (int): Index of the vcFeature in the collisions list.
Returns:
vcFeature: Feature at the given index.

Exceptions:
IndexError: When index is out of bounds in the collisions list.
RuntimeError: When collisions list element at the given index is invalid.
getHitGeometrySetvcGeometrySetInteger indexReturns a vcGeometrySet at a given index in detected collisions list.
See more
Parameters:
index (int): Index of the vcGeometrySet in the collisions list.

Returns:
vcGeometrySet: Geometry set at the given index.

Exceptions:
IndexError: When index is out of bounds in the collisions list.
RuntimeError: When collisions list element at the given index is invalid.
getHitNodevcNodeInteger indexReturns a vcNode at a given index in detected collisions list.
See more
Parameters:
index (int): Index of the vcNode in the collisions list.

Returns:
vcNode: Node at the given index.

Exceptions:
IndexError: When index is out of bounds in the collisions list.
RuntimeError: When collisions list element at the given index is invalid.
testAllCollisionsBooleanOptional Keyword[tolerance = Real]Detects all collisions of box with node list.
See more
Parameters:
tolerance (float): Optional argument to detect collisions within a certain distance. By default, tolerance is zero.

Returns:
Boolean: True if a collision is detected, otherwise returns False.

Exceptions:
RuntimeError: When there is no license for Proximity Services.
testOneCollisionBooleanOptional Keyword[tolerance = Real]Detects the first collision of box with node list.
See more
Parameters:
tolerance (float): Optional argument to detect collisions within a certain distance. By default, tolerance is zero.

Returns:
Boolean: True if a collision is detected, otherwise returns False.

Exceptions:
RuntimeError: When there is no license for Proximity Services.

Example: Test Collisions By Using Volume Detector

"""This example shows how to test if any node collides with a volume."""

import vcCore as vc

async def OnRun():
  world = vc.getWorld()

  insideDetector = world.createVolumeDetector()
  insideDetector.Corner1 = vc.vcVector.new()
  insideDetector.Corner2 = vc.vcVector.new(102.0, 102.0, 102.0)

  all_nodes_entry = vc.vcNodeListEntry.new()
  all_nodes_entry.Node = world
  all_nodes_entry.Scope = vc.vcNodeListEntryScope.TREE
  all_nodes_entry.Type = vc.vcNodeListEntryType.INCLUDE
  insideDetector.NodeList = [all_nodes_entry]

  insideDetector.TestMethod = vc.vcVolumeDetectorTestMethod.INTERSECT
  insideHit1 = insideDetector.testAllCollisions()

  insideDetector.TestMethod = vc.vcVolumeDetectorTestMethod.CENTER_INSIDE
  insideHit2 = insideDetector.testAllCollisions()

  insideDetector.TestMethod = vc.vcVolumeDetectorTestMethod.INSIDE
  insideHit3 = insideDetector.testAllCollisions()

  print("--------")
  print("{} INTERSECT".format(insideHit1))
  print("{} CENTER_INSIDE".format(insideHit2))
  print("{} INSIDE".format(insideHit3))